package com.niiwoo.activity.event.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by dengyunhui on 2018/03/21.
 */
@AllArgsConstructor
@Getter
public enum YesOrNoEnum {

    YES(Byte.valueOf("1"), "是"),
    NO(Byte.valueOf("0"), "否");

    private Byte code;
    private String desc;

    public static YesOrNoEnum valueOf(Byte code) {
        for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
            if (code.byteValue() == yesOrNoEnum.getCode()) {
                return yesOrNoEnum;
            }
        }
        return null;
    }
}

